package de.breitbeil.jbooking.ui.form;

import java.util.List;

import javax.swing.JComponent;
import javax.swing.JLabel;

import org.springframework.richclient.filechooser.DefaultFileFilter;
import org.springframework.richclient.form.AbstractForm;
import org.springframework.richclient.form.binding.swing.SwingBindingFactory;
import org.springframework.richclient.form.builder.TableFormBuilder;

import de.breitbeil.jbooking.richclient.filechooser.FileChooserComboBox;

public class ExcelExportForm extends AbstractForm {

    public static final String ID = "excelExportForm";
    
    private List<String> availableProperties;

    public ExcelExportForm(ExcelExportFormObject formObject, List<String> availableProperties) {
        super(formObject);
        setId(ID);
        
        this.availableProperties = availableProperties;
    }

    @Override
    protected JComponent createFormControl() {
        SwingBindingFactory bindingFactory = (SwingBindingFactory) getBindingFactory();
        TableFormBuilder formBuilder = new TableFormBuilder(bindingFactory);
        formBuilder.setLabelAttributes("colGrId=label colSpec=right:pref");

        FileChooserComboBox fileChooser = new FileChooserComboBox(getFormModel(), "filename");
        fileChooser.setFilter(new DefaultFileFilter("xls"));

        formBuilder.addSeparator(getMessage(ID + ".fileSeparator.label"));
        formBuilder.row();
        formBuilder.getLayoutBuilder().cell(new JLabel("Datei"), formBuilder.getLabelAttributes());
        formBuilder.getLayoutBuilder().gapCol();
        formBuilder.getLayoutBuilder().cell(fileChooser.getControl());
        formBuilder.row();
        /*formBuilder.addSeparator(getMessage(ID + ".cellsSeparator.label"));
        formBuilder.add(bindingFactory.createBoundShuttleList()); */

        return formBuilder.getForm();
    }

}
